package Dao;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import Entity.Thumb;
import OracleHelper.OracleHelper;

public class ThumbDao {
	public int addThumbInformation(String resourceID,String userName) {
		String sql="insert into thumb values('"+resourceID+"','"+userName+"')";
		return new OracleHelper().executeUpdate(sql);		
	}
	
	/*搜索某课程的所有点赞信息*/
	public List<Thumb> queryThumbByResourceID(String resourceID){
		List<Thumb> tlist=new ArrayList<Thumb>();
		String sql="select * from thumb whhere resourceID='"+resourceID+"'";
		ResultSet rs=OracleHelper.executeQuery(sql);
		try {
			while(rs.next()) {
				Thumb thumb=new Thumb();
				thumb.setResourceID(rs.getString(1));
				thumb.setUserName(rs.getString(2));
				tlist.add(thumb);
			}
		}catch(Exception ex) {
			ex.printStackTrace();
		}
		return tlist;
		
	}

}
